<template>
    <!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
	 <view style="height: 30px">

		<u-tabbar v-model="current" 
			:list="list" 
			:mid-button="false" 
			:hide-tab-bar="false" 
			active-color="rgb(80, 152, 255)"
			:before-switch="beforeSwitch"
			/>
	 </view>
    
</template>

<script>
	export default {
        name: 'teacherTabbar',
		data() {
			return {
                current: 0,
				list: [{
						pagePath: '/pages/index/index', 
						iconPath: "home-fill",
						selectedIconPath: "home-fill",
						text: '课表',
						count: 0,
						customIcon: false,
						tabbar: false,
					},
					{
						pagePath: '/pages/teacher/my',
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',
						customIcon: false,
						tabbar: false
					}
				]
			}
		},
        methods: {
            beforeSwitch(index) {
                const page = this.list[index]
				if (page.tabbar) {
					uni.switchTab({
						url: page.pagePath
					})
				} else {
					uni.navigateTo({
						url: page.pagePath,
					})
				}
                return false
            }
        }
	}
</script>
